package com.zjh.r2dbc.repositories;

import com.zjh.r2dbc.entity.User;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

/**
 * @Auther: zjh
 * @Date: 2025/11/5 - 11 - 05 - 1:41
 * @Description: com.zjh.r2dbc.respositories
 * @version: 1.0
 */
@Repository
public interface UserRepositories extends ReactiveCrudRepository<User,Integer> {//那个类，主键类型
    //默认继承了一些curd 方法 mybatis-plus
    //QBC query by Criteria
    //QBE query by example
    //自定义方法
    Flux<User> findUserByIdAndName(Integer id, String name);
    //自定义sql 使用query注解复杂查询  或者使用客户端工具查询
    @Query("select  * from user where id=:id ")
    Flux<User> finds(@Param("id") Integer id);
}
